Skip to content

优化微软登录未购买提示#5611

Merged
Glavo merged 12 commits into
HMCL-dev:mainfrom
CiiLu:msmmsmsmsmsmsm
Apr 26, 2026
Merged

优化微软登录未购买提示#5611
Glavo merged 12 commits into
HMCL-dev:mainfrom
CiiLu:msmmsmsmsmsmsm

Conversation

@CiiLu
Copy link
Copy Markdown
Contributor

@CiiLu CiiLu commented Feb 22, 2026

image image 网页端购买 Minecraft 前必须创建 Xbox 档案。微软商店客户端购买完会弹窗引导创建 Xbox 档案,但不排除用户会直接关掉,所以不能直接认定为未购买。

@CiiLu CiiLu marked this pull request as draft February 22, 2026 03:39
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
Copy link
Copy Markdown
Member

@burningtnt burningtnt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在出现 no_license 或 no_character 错误时,应当主动将右下角的“登录”按键更改为“购买 Minecraft”或“创建档案”,并相对应地更改点击按钮后的动作。

在用户点击过一次按钮后,该按钮才应当显示“重新登陆”

Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/auth/microsoft/MicrosoftService.java Outdated
@CiiLu CiiLu marked this pull request as ready for review April 21, 2026 14:14
@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 23, 2026

这个 PR 做完了?确认了有效性吗?

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 23, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the Microsoft account authentication process by distinguishing between a missing Minecraft license and a missing game profile. It introduces new exception types and updates localization files for English and Chinese. A logic flaw was identified in the profile retrieval process: when a 404 error occurs but a license is found, the code fails to throw the appropriate profile-not-found exception, which would lead to subsequent execution errors. Additionally, the review suggests adding null checks for the license response to prevent potential NullPointerExceptions.

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 23, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Minecraft269
Copy link
Copy Markdown

Minecraft269 commented Apr 24, 2026

CC @Glavo

@TheWhiteDog9487
Copy link
Copy Markdown

部分情况下买了游戏有档案直接登陆也不行,去minecraft.net登陆一下账号再登陆启动器就好了,我不知道具体原因
要不把这个情况的提示也加进去?

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 24, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refines the Microsoft authentication flow by distinguishing between a missing Minecraft license and a missing game profile, introducing specific exceptions and updating localization strings. A review comment identifies a potential NullPointerException in the license check logic and suggests adding retry logic for consistency with other API calls.

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 26, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the Microsoft account authentication process by distinguishing between a missing Minecraft license and a missing game profile. It introduces specific exceptions and localized error messages for both cases. In MicrosoftService.java, a check for the game_minecraft entitlement was added when a profile is not found. A review comment suggests adding a retry mechanism to the license entitlement API call to enhance reliability and maintain consistency with other network requests in the codebase.

Comment on lines +251 to +253
MinecraftLicense license = HttpRequest.GET("https://api.minecraftservices.com/entitlements/license")
.authorization(tokenType, accessToken)
.getJson(MinecraftLicense.class);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在获取许可证信息时,建议添加 .retry(5),以保持与该文件中其他 API 请求的一致性,并提高在网络不稳定情况下的登录成功率。

            MinecraftLicense license = HttpRequest.GET("https://api.minecraftservices.com/entitlements/license")
                    .authorization(tokenType, accessToken)
                    .retry(5)
                    .getJson(MinecraftLicense.class);

@Glavo Glavo merged commit d6648a8 into HMCL-dev:main Apr 26, 2026
2 checks passed
@CiiLu CiiLu deleted the msmmsmsmsmsmsm branch April 29, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants